import { defineFakeRoute } from "vite-plugin-fake-server/client";

// 模拟刷新token接口
export default defineFakeRoute([
  {
    url: "/refresh-token",
    method: "post",
    response: ({ body }) => {
      if (!body.refreshToken) {
        return {
          code: -1,
          msg: "refreshToken 不能为空",
          data: null
        };
      }
      return {
        code: 0,
        msg: "刷新token成功",
        data: {
          token: "eyJhbGciOiJIUzUxMiJ9.newAdmin",
          refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh",
          expires: "2024/10/30 00:00:00",
          accountId: 1
        }
      };
    }
  }
]);
